/*
 * ExpenseTypesFacade.java
 *
 * Created on 7 de Julho de 2007, 14:44
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package br.com.ecs.persistence.facade;

import br.com.ecs.persistence.entity.ExpenseType;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author Danielle
 */
@Stateless
public class ExpenseTypeFacade implements ExpenseTypeFacadeLocal {

    @PersistenceContext
    private EntityManager em;
    
    /** Creates a new instance of ExpenseTypesFacade */
    public ExpenseTypeFacade() {
    }

    public void create(ExpenseType expenseTypes) {
        em.persist(expenseTypes);
    }

    public void edit(ExpenseType expenseTypes) {
        em.merge(expenseTypes);
    }

    public void destroy(ExpenseType expenseTypes) {
        em.merge(expenseTypes);
        em.remove(expenseTypes);
    }

    public ExpenseType find(Object pk) {
        return (ExpenseType) em.find(ExpenseType.class, pk);
    }

    public List findAll() {
        return em.createQuery("select object(o) from ExpenseType as o").getResultList();
    }
    
}
